import request from "./axios.js";

/** 考试预约 **/
export const Appointment = data => {
  return request({
    method: 'post',
    url: 'appointmentExam.php',
    data
  })
}

/** 登录请求 **/
export const Login = data => {
  return request({
    method: 'post',
    url: '/login.php',
    data
  })
}

/** 权限获取 **/
export const GetPermission = () => {
  return request(({
    method: 'get',
    url: '/getPermission.php'
  }))
}

/** 密码修改 **/
export const SetPassword = data => {
  return request({
    method: 'post',
    url: '/setPassword.php',
    data
  })
}

/** 添加题目 **/
export const AddQuestion = data => {
  return request({
    method: 'post',
    url: "/questionsBank/addQuestionBank.php",
    data
  })
}

/** 获取题库 **/
export const GetQuestionsBank = () => {
  return request({
    method: 'get',
    url: '/questionsBank/getQuestionsBank.php'
  })
}

/** 修改题目信息 **/
export const UpdateQuestion = data => {
  return request({
    method: 'post',
    url: '/questionsBank/updateQuestionBank.php',
    data
  })
}

/** 删除题目信息 **/
export const DeleteQuestion = data => {
  return request({
    method: 'post',
    url: '/questionsBank/deleteQuestionBank.php',
    data
  })
}

/** 预约信息获取 **/
export const GetAppointments = () => {
  return request({
    method: 'get',
    url: '/appointmentManege/getAppointments.php'
  })
}

/** 修改预约状态 **/
export const UpdateAppointmentStatus = data => {
  return request({
    method: 'post',
    url: '/appointmentManege/updateAppointmentStatus.php',
    data
  })
}

/** 获取题目列表 **/
export const GetQuestions = () => {
  return request({
    method: 'get',
    url: '/issuePaper/getQuestions.php'
  })
}

/** 进行试卷的发布 **/
export const IssuePaper = data => {
  return request({
    method: 'post',
    url: '/issuePaper/issuePaper.php',
    data
  })
}

/** 获取试卷列表 -> 管理员 **/
export const GetPapers = () => {
  return request({
    method: 'get',
    url: '/issuePaper/getPapers.php'
  })
}

/** 获取考生试卷列表 **/
export const GetPapersAsExam = () => {
  return request({
    method: 'get',
    url: '/examinee/getPapers.php'
  })
}

/** 获取试卷的所有题目 **/
export const GetPaperQuestions = data => {
  return request({
    method: 'post',
    url: '/examinee/getPaperQuestions.php',
    data
  })
}

/** 提交试卷 | 异步提交 **/
export const SubmitPaper = data => {
  return request({
    method: 'post',
    url: '/examinee/submitPaper.php',
    data
  })
}

/** 查看答题情况 **/
export const SelectPaperInfo = data => {
    return request({
      method: 'post',
      url: '/examinee/getResultInfo.php',
      data
    })
}

